package com.ftw.commons.network

import android.content.Context
import com.ftw.commons.utils.AppUtils
import com.ftw.commons.utils.Utils
import okhttp3.Interceptor
import okhttp3.Response

/**
 * 描    述：
 * 作    者：fantianwen
 * 时    间：2019/2/15  4:44 PM
 */
class NetWorkInterceptor(val mContext: Context) : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val builder = chain.request().newBuilder()
        builder.addHeader("appVersion", AppUtils.getAppVersionName(mContext)!!)
        builder.addHeader("Content-Type", "application/json")
        builder.addHeader("User-Agent", "Android")
        return chain.proceed(builder.build())
    }

}